package com.chen.admin.controller;


import com.chen.admin.common.Result;
import com.chen.admin.entity.AdminLogin;
import com.chen.admin.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin")

@CrossOrigin(origins = "http://localhost:8080")
public class AdminController {


    @Autowired
    private AdminService adminService;

    /**
     * 登录接口
     */

    @PostMapping("/login")
    public Result login(@RequestBody AdminLogin adminLogin)
    {
       Result result= adminService.login(adminLogin);
       return result;

    }

    /**
     * 注册接口
     */

    @PostMapping("/register")
    public Result register(@RequestBody AdminLogin adminLogin)
    {
        Result result=  adminService.register(adminLogin);
        return result;
    }
}
